<extend name="Config/base"/>

<block name="body">
<script>
    function center_toggle(name) {
        var show = $('#' + name + '_panel').css('display');
        $('.center_panel').hide();
        $('.center_arrow_right').show();
        $('.center_arrow_bottom').hide()
        if (show == 'none') {
            $('#' + name + '_panel').show();
            $('#' + name + '_toggle_right').hide();
            $('#' + name + '_toggle_bottom').show()
        } else {
            $('#' + name + '_toggle_right').show();
            $('#' + name + '_toggle_bottom').hide()
        }

    }
</script>
<div id="center">
    <div id="center_base">
        <div class="with-padding">


            <div id="center_account">
                <div class="row">
                    <div class="col-xs-12">
                        <ul class="nav nav-secondary">
                            <li class="active"><a href="#base" data-toggle="tab">基本资料</a></li>
                            <volist name="profile_group_list" id="vl">
                                <li>
                                    <a href="#expand_{$vl.id}" data-toggle="tab">{$vl.profile_name}</a>
                                </li>
                            </volist>
                        </ul>

                    </div>
                </div>
                <div class="tab-content">
                    <div class="tab-pane active" id="base">
                        <div class="with-padding">
                            <div class="row">
                                <div class="col-md-8 center_info form-horizontal">

                                    <php>if(check_reg_type('username')){</php>
                                    <div class="form-group">
                                        <label for="aUsername" class="col-sm-2 control-label">用户名</label>

                                        <div class="col-sm-10">
                                            <php>if($accountInfo['username']){</php>
                                            <span class="lh32">{$accountInfo['username']}</span>
                                            <php>}else{</php>
                                            <input type="text" class="form-control pull-left" id="aUsername" value=""
                                                   placeholder="还未设置用户名，赶快来设置吧~">
                                            <a class="pull-left lh32 saveUsername" style="margin-left: 10px">设置</a>
                                            <script>
                                                $(function () {
                                                    $('.saveUsername').click(function () {
                                                        var username = $(this).prev().val();
                                                        if (!username) {
                                                            toast.error('用户名不能为空！');
                                                            return false;
                                                        }
                                                        if (confirm('用户名一经设置就不能修改，确定要设置么？')) {
                                                            $.post("{:U('ucenter/config/saveUsername')}", {username: username}, function (res) {
                                                                handleAjax(res);
                                                            })
                                                        }
                                                    })
                                                })
                                            </script>
                                            <php>}</php>
                                        </div>
                                    </div>

                                    <php>}</php>

                                    <php>if(check_reg_type('email')){</php>
                                    <div class="form-group">
                                        <label for="aEmail" class="col-sm-2 control-label">邮箱</label>

                                        <div class="col-sm-10">
                                            <input type="email" class="form-control pull-left" id="aEmail"
                                                   placeholder="邮箱"
                                                   value="{$accountInfo.email}">
                                            <a class="pull-left lh32 " style="margin-left: 10px"
                                               data-remote="{:U('ucenter/config/changeaccount',array('tag'=>'email'))}"
                                               data-toggle="modal">修改邮箱</a>
                                        </div>
                                    </div>
                                    <php>}</php>

                                    <php>if(check_reg_type('mobile')){</php>

                                    <div class="form-group">
                                        <label for="aMobile" class="col-sm-2 control-label">手机</label>

                                        <div class="col-sm-10">
                                            <input type="text" class="form-control pull-left" id="aMobile"
                                                   placeholder="手机"
                                                   value="{$accountInfo.mobile}">
                                            <a class="pull-left lh32 " style="margin-left: 10px"
                                               data-remote="{:U('ucenter/config/changeaccount',array('tag'=>'mobile'))}"
                                               data-toggle="modal">修改手机</a>
                                        </div>
                                    </div>
                                    <php>}</php>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-8">
                                    <form class="form-horizontal center_info ajax-form" role="form"
                                          action="{:U('Ucenter/Config/index')}" method="post">
                                        <div class="form-group">
                                            <label for="nickname" class="col-sm-2 control-label">昵称</label>

                                            <div class="col-sm-10">
                                                <input type="text" class="form-control" id="nickname" name="nickname"
                                                       value="{$user.nickname|op_t}"
                                                       placeholder="昵称">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">性别</label>

                                            <div class="col-sm-10">
                                                <label class="radio-inline">
                                                    <input name="sex" type="radio" value="1"
                                                    <eq name="user.sex" value="1"> checked</eq>
                                                    > 男
                                                </label>
                                                <label class="radio-inline">
                                                    <input name="sex" type="radio" value="2"
                                                    <eq name="user.sex" value="2"> checked</eq>
                                                    > 女
                                                </label>
                                                <label class="radio-inline">
                                                    <input name="sex" type="radio" value="0"
                                                    <eq name="user.sex" value="0"> checked</eq>
                                                    > 保密
                                                </label>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="email" class="col-sm-2 control-label">邮箱</label>

                                            <div class="col-sm-10">
                                                <input type="email" class="form-control" id="email" placeholder="邮箱"
                                                       name="email"
                                                       value="{$user.email|htmlspecialchars}">
                                            </div>
                                        </div>


                                        <div class="form-group position">
                                            <label for="email" class="col-sm-2 control-label">所在地</label>

                                            <div class="col-sm-10">
                                                {:hook('J_China_City',array('province'=>$user['pos_province'],'city'=>$user['pos_city'],'district'=>$user['pos_district'],'community'=>$user['pos_community']))}
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="signature" class="col-sm-2 control-label">个性签名</label>

                                            <div class="col-sm-10">
                                                <textarea id="signature" name="signature" class="form-control"
                                                          style="width: 100%; height: 6em;resize: none">{$user.signature|htmlspecialchars}</textarea>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <button type="submit" class="btn btn-primary">保存</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>

                            </div>

                        </div>
                    </div>

                    <volist name="profile_group_list" id="vo">
                        <div class="tab-pane" id="expand_{$vo.id}">

                            <div class="with-padding">
                                <div class="row">
                                    <div class="col-xs-8">

                                        <include file="Config/expandinfo"/>
                                    </div>


                                </div>


                                </div>


                        </div>


                    </volist>

                </div>


            </div>
        </div>


    </div>
</div>


</div>

</block>